import {Gear} from './Gear.js';

export class SpurGear extends Gear {
  /**
   * 计算绘制参数
   * 齿顶高 ha = m * ha*
   * 齿根高 hf = m * (ha* + c*)
   * 齿高 h = ha + hf = m * (2 * ha* + c*)
   */
  constructor(z, m, alpha, b, rho, haC, cC, beta, x) {
    super(z, m, alpha, b, rho, haC, cC, beta, x);
    /**
     * 分度圆直径 d = m * z
     */
    this.dividingD = this.module * this.teethNumber;
    this.rd = this.dividingD / 2;
    /**
     * 基圆直径 db = d * cos(α)
     */
    this.baseD = this.dividingD * Math.cos(this.alpha);
    this.rb = this.baseD / 2;
    /**
     * 齿顶圆直径 da = d + 2 * ha
     */
    this.addendumD = this.dividingD + 2 * this.module * this.addendumCoefficient + 2 * this.modification * this.module;
    this.ra = this.addendumD / 2;
    /**
     * 齿根圆直径 df = d - 2 * hf
     */
    this.dedendumD = this.dividingD - 2 * this.module * (this.addendumCoefficient + this.clearanceCoefficient) + 2 * this.modification * this.module;
    this.rf = this.dedendumD / 2;
  }
}
